//
//  ProDetail.m
//  LiWuShuo
//
//  Created by 袁小航 on 14/11/19.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "ProDetail.h"
#import "Define.h"

@implementation ProDetail

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
//        创建上方的伪navigation
        [self createProDetailTopNavView];
        
//        创建ProDetailView
        [self createProDetailView];
        
//        创建webView下方的喜欢和分享按钮
//        [self createWebViewBottom];
        
//        创建下方的伪TabBar
        [self createProDetailBottomView];
        
    }
    return self;

}
//#pragma mark - 创建webView下方的喜欢和分享按钮
//- (void)createWebViewBottom
//{
//    self.webViewBottomView = [[UIView alloc]initWithFrame:CGRectMake(0, _proDetailWebView.frame.size.height - 49, MAINVIEW_WIDTH, 49)];
//    NSLog(@"!!%.2f", _proDetailWebView.scrollView.contentSize.height);
//    _webViewBottomView.backgroundColor = [UIColor orangeColor];
//    [_proDetailWebView addSubview:_webViewBottomView];
//    
//    self.webViewBottomColl = [UIButton buttonWithType:UIButtonTypeCustom];
//    _webViewBottomColl.frame = CGRectMake(50, 10, 60, 30);
//    [_webViewBottomColl setTitle:@"喜欢" forState:UIControlStateNormal];
//    [_webViewBottomView addSubview:_webViewBottomColl];
//    
//    self.webViewBottomShare = [UIButton buttonWithType:UIButtonTypeCustom];
//    _webViewBottomShare.frame = CGRectMake(210, 10, 60, 30);
//    [_webViewBottomShare setTitle:@"分享" forState:UIControlStateNormal];
//    [_webViewBottomView addSubview:_webViewBottomShare];
//}

#pragma mark - 创建下方的伪TabBar
- (void)createProDetailBottomView
{
//    伪TabBar
    self.detailTab = [[UIView alloc]initWithFrame:CGRectMake(0, MAINVIEW_HEIGHT-49, MAINVIEW_WIDTH, 49)];
    UIColor *altColor = [UIColor colorWithWhite:0.1 alpha:0.6];
    _detailTab.backgroundColor = altColor;
    [self addSubview:_detailTab];
    
//    收藏按钮
    self.detailTabCollButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _detailTabCollButton.frame = CGRectMake(DET_TAB_COLBUTTON_X, 9, 30, 30);
    [_detailTabCollButton setBackgroundImage:[UIImage imageNamed:@"collN.png"] forState:UIControlStateNormal];
    
    [_detailTab addSubview:_detailTabCollButton];
    
//    分享按钮
    self.detailTabShareButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _detailTabShareButton.frame = CGRectMake(MAINVIEW_WIDTH / 2 + DET_TAB_COLBUTTON_X, 9, 30, 30);
    [_detailTabShareButton setBackgroundImage:[UIImage imageNamed:@"share.png"] forState:UIControlStateNormal];
    [_detailTab addSubview:_detailTabShareButton];
    
//    设置伪TabBar中间的分割线
    UILabel *cutLine = [[UILabel alloc]initWithFrame:CGRectMake(MAINVIEW_WIDTH / 2, 0, 1, 49)];
    cutLine.backgroundColor = [UIColor grayColor];
    [_detailTab addSubview:cutLine];
    
}

#pragma mark - 创建上方的伪navigation
- (void)createProDetailTopNavView
{
    //    创建最底层Image
    self.detailBackImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, DET_IMAGEVIEW_ORIGIN_Y, MAINVIEW_WIDTH, DET_IMAGEVIEW_ORIGIN_HEITH)];
    [self addSubview:_detailBackImage];
    
    self.detailBackImageInfo = [[UILabel alloc]initWithFrame:CGRectMake(0, DET_IMAGEVIEW_ORIGIN_HEITH, MAINVIEW_WIDTH, 60)];
    [_detailBackImageInfo setFont:[UIFont fontWithName:@"Helvetica-Bold" size:24]];
    _detailBackImageInfo.numberOfLines = 2;
    _detailBackImageInfo.textColor = [UIColor whiteColor];
    [_detailBackImage addSubview:_detailBackImageInfo];
    
    //    伪nav
    self.detailNav = [[UIView alloc]initWithFrame:CGRectMake(0, 0, MAINVIEW_WIDTH, DET_FINAL_HIGHT)];
    _detailNav.backgroundColor = [UIColor clearColor];
    [self addSubview:_detailNav];
    
    UIImageView *navImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, MAINVIEW_WIDTH, _detailNav.frame.size.height - 10)];
    [navImage setImage:[UIImage imageNamed:@"dest_place_title_shadow_top@2x.png"]];
    [_detailNav addSubview:navImage];
    
    self.detailNavTitle = [[UILabel alloc]initWithFrame:CGRectMake(DET_BACK_BUTTON_X + DET_BACK_BUTTON_WIDTH, DET_BACK_BUTTON_Y, MAINVIEW_WIDTH - DET_BACK_BUTTON_X - 20, 25)];
    _detailNavTitle.textColor = [UIColor whiteColor];
    _detailNavTitle.textAlignment = YES;
    _detailNavTitle.font = [UIFont systemFontOfSize:16];
    [_detailNav addSubview:_detailNavTitle];
}


#pragma mark - 创建ProDetailView
- (void)createProDetailView
{
    self.proDetailWebView = [[UIWebView alloc]initWithFrame:CGRectMake(0, DET_FINAL_HIGHT, MAINVIEW_WIDTH, MAINVIEW_HEIGHT - DET_FINAL_HIGHT)];
    _proDetailWebView.scrollView.contentInset = UIEdgeInsetsMake(140, 0, 0, 0);
    _proDetailWebView.backgroundColor = [UIColor clearColor];
    [self addSubview:_proDetailWebView];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
